package com.project.bean;

import com.project.service.IUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
import org.springframework.stereotype.Indexed;
import org.springframework.stereotype.Service;

@Service
public class Manager {
    @Autowired //自动注入，扫描已注册的spring组件，
    // 注入匹配该属性的组件,前提还是该接口只有一个实现类
    @Qualifier("us")//user对应的实现类。按名称注入该接口组件
    private IUserService service;

    public void add(){
        service.speak();
    }
}
